package main

import (
	"fmt"
)

func adder() func(int) int {
	sum := 0
	return func(v int) int {
		sum += v
		return sum
	}
}

func adder1(x int) func(i int) int {
	return func(i int) int {
		return i + x
	}
}

func main() {
	a := adder()
	for i := 0; i < 10; i++ {
		fmt.Println(a(i))
	}
	b := adder1(5)
	fmt.Println(b(3))
}
